<?php 
class Teacher_Form_FrmTeacher extends Zend_Form
{
	public function init()
    {
    }
    public function formteacher($formteacher = null){ 
    	$db = new Application_Model_DbTable_DbGlobal();
    	//$teacher_id = new Zend_Form_Element_Hidden("teacher_id");
    	$id = new Zend_Form_Element_Text("id_code");
    		$id->setAttribs(array("class"=>"form-control validate[required]"));
    	//password    	
    	$password=new Zend_Form_Element_Password('password');
    	$password->setAttribs(array(
    		'id'=>'password',
    		'class'=>'form-control validate[required,minSize[5],maxSize[10]]',
    	));
    	$this->addElement($password);
//confirm password    	
    	$confirm_password=new Zend_Form_Element_Password('confirm_password');
    	$confirm_password->setAttribs(array(
    		'id'=>'confirm_password',
    		'class'=>'form-control validate[required,equals[password]]',
    	));
    	$this->addElement($confirm_password);
    	$teacher_id = new Zend_Form_Element_Hidden("teacher_id");
    		$teacher_id->setAttribs(array("class"=>"form-control validate;[required]"));
    	$teacher_name = new Zend_Form_Element_Text("teacher_name");
    		$teacher_name->setAttribs(array("class"=>"form-control validate[required]"));
    	$gender = new Zend_Form_Element_Select("gender");
    		$option_tgender = array(1=>"Mr",2=>"Mis");
    		$gender->setMultiOptions($option_tgender);
    		$gender->setAttribs(array("class"=>"form-control validate[required]"));  		
    	$pob = new Zend_Form_Element_Text("pob");
    		$pob->setAttribs(array("class"=>"form-control validate[required]"));
    	$date = new Zend_Date();
    	$dob = new Zend_Form_Element_Text('dob');
    	$dob->setAttribs(array('placeholder' => 'Click To Choose Date','class'=>'form-control validate[required]'));
    		//$dob ->setValue($date->get('YYYY-MM-dd'));
    	$address = new Zend_Form_Element_Text("address");
    		$address->setAttribs(array("class"=>"form-control validate[required]"));
    	$tel = new Zend_Form_Element_Text("tel");
    		$tel->setAttribs(array("class"=>"form-control validate[required,phone]"));
    	$email = new Zend_Form_Element_Text("email");
    		$email->setAttribs(array("class"=>"form-control validate[required,email]"));
    		
    		
    		
    		$sql=$db->getGlobalDb('SELECT ed.`ed_id`,ed.`ed_name` FROM tbl_education AS ed WHERE ed.`status`=1');
    		$options=array(''=>'Please Select','-1'=>'Add New Vendor');
    		if(!empty($sql)) foreach($sql as $read) $options[$read['ed_id']]=$read['ed_name'];
    		
    	$education_level = new Zend_Form_Element_Select("education");
    		$education_level->setAttribs(array("class"=>"form-control validate[required]"));
    		$education_level->setMultiOptions($options);
    		
    	$finish_from = new Zend_Form_Element_Text("finish_from");
    		$finish_from->setAttribs(array("class"=>"form-control validate[required]"));
    	$year = new Zend_Form_Element_Text("year");
    		$year->setAttribs(array("class"=>"form-control validate[required]"));
    	$skill = new Zend_Form_Element_Text("skill");
    		$skill->setAttribs(array("class"=>"form-control validate[required]"));
    	$subject = new Zend_Form_Element_Text("subject");
    		$subject->setAttribs(array("class"=>"form-control validate[required]"));
    	$status = new Zend_Form_Element_Select("status");
    		$option_satatus = array(1=>"Active",0=>"Disactive");
    		$status->setMultiOptions($option_satatus);
    		$status->setAttribs(array("class"=>"form-control validate[required]"));
    	$description = new Zend_Form_Element_Text("description");
    		$description->setAttribs(array("class"=>"form-textarea"));
    	$photo = new Zend_Form_Element_File("photo");    	
    	$this->addElements(array($id,$teacher_id,$teacher_name,$gender,$pob,$dob,$address,$tel,$email,$education_level,
    			$finish_from,$year,$skill,$status,$description,$subject,$photo,$password,$confirm_password
    	));
    	Application_Form_DateTimePicker::addDateField(array("dob"));
    	if($formteacher!=""){
    		$id->setValue($formteacher["id_code"]);
    		$teacher_id->setValue($formteacher["teacher_id"]);
    		$teacher_name->setValue($formteacher["teacher_name"]);
    		$gender->setValue($formteacher["gender"]);
    		$pob->setValue($formteacher["pob"]);
    		$dob->setValue($formteacher["dob"]);
    		$address->setValue($formteacher["address"]);
    		$tel->setValue($formteacher["tel"]);
    		$email->setValue($formteacher["email"]);
    		$education_level->setValue($formteacher["education_level"]);
    		$finish_from->setValue($formteacher["finish_from"]);
    		$year->setValue($formteacher["year"]);
//     		$skill->setValue($formteacher["skill"]);
//     		$subject->setValue($formteacher["subject"]);
    		$status->setValue($formteacher["status"]);
    		$description->setValue($formteacher["description"]);
    	}
    	return $this;
    }
    public function addskill($addskill=null){
    	$sill_id = new Zend_Form_Element_Text("add_skill_id");
    	$skill = new Zend_Form_Element_Text("skills");
    	$skill->setAttribs(array("class"=>"form-control", "required"=>"required"));   	
    	$status = new Zend_Form_Element_Select("skill_status");
    	$option_satatus = array(1=>"Active",0=>"Disactive");
    	$status->setMultiOptions($option_satatus);
    	$status->setAttribs(array("class"=>"form-control validate[required]"));
    	$this->addElements(array($sill_id,$skill,$status));
    	if($addskill!=""){
    		$sill_id->setValue($addskill["skill_id"]);
    		$skill->setValue($addskill["skill"]);
    		$status->setValue($addskill["skill_status"]);
    	}
    	return $this;
    }
    
    public function addEdu($addEdu=null){
    	$edu_id = new Zend_Form_Element_Text("edu_id");
    	$edu = new Zend_Form_Element_Text("ed_name");
    	$edu->setAttribs(array("class"=>"form-control", "required"=>"required"));
    	$status = new Zend_Form_Element_Select("status");
    	$option_satatus = array(1=>"Active",0=>"Disactive");
    	$status->setMultiOptions($option_satatus);
    	$status->setAttribs(array("class"=>"form-control validate[required]"));
    	$this->addElements(array($edu_id,$edu,$status));
    	if($addEdu!=""){
    		$edu_id->setValue($addEdu["ed_id"]);
    		$edu->setValue($addEdu["ed_name"]);
    		$status->setValue($addEdu["status"]);
    	}
    	return $this;
    }
}
?>
